Crate mp4ameta[][src]

A library for reading and writing iTunes style MPEG-4 audio metadata.

Examples

The easy way

let mut tag = mp4ameta::Tag::read_from_path("music.m4a").unwrap();

println!("{}", tag.artist().unwrap());

tag.set_artist("artist");
tag.write_to_path("music.m4a").unwrap();

The hard way

use mp4ameta::{Data, Fourcc, Tag};

let mut tag = Tag::read_from_path("music.m4a").unwrap();
let artist_ident = Fourcc(*b"\xa9ART");

let artist = tag.string(&artist_ident).next().unwrap();
println!("{}", artist);

tag.set_data(artist_ident, Data::Utf8("artist".to_owned()));
tag.write_to_path("music.m4a").unwrap();

Using freeform identifiers

use mp4ameta::{Data, FreeformIdent, Tag};

let mut tag = Tag::read_from_path("music.m4a").unwrap();
let isrc_ident = FreeformIdent::new("com.apple.iTunes", "ISRC");

let isrc = tag.string(&isrc_ident).next().unwrap();
println!("{}", isrc);

tag.set_data(isrc_ident, Data::Utf8("isrc".to_owned()));
tag.write_to_path("music.m4a").unwrap();

Modules

ident

A module for working with identifiers.

Macros

be_int

Attempts to read a big endian integer at the specified index from a byte slice.

set_be_int

Attempts to write a big endian integer at the specified index to a byte vector.

Structs

AtomData

A struct representing data that is associated with an atom identifier.

AudioInfo

A struct containing information about a mp4 track.

Error

A struct able to represent any error that may occur while performing metadata operations.

Fourcc

A 4 byte atom identifier (four character code).

FreeformIdent

An identifier of a freeform (----) atom containing borrowd mean and name strings.

Tag

A MPEG-4 audio tag containing metadata atoms

Enums

AdvisoryRating

An enum describing the rating of a file stored in the rtng atom.

ChannelConfig

An enum representing the channel configuration of an MPEG-4 audio track.

Data

An enum that holds different types of data defined by Table 3-5 Well-known data types.

DataIdent

An identifier for data.

ErrorKind

Kinds of errors that may occur while performing metadata operations.

MediaType

An enum describing the media type of a file stored in the stik atom.

SampleRate

An enum representing the sample rate of an MPEG-4 audio track.

Constants

STANDARD_GENRES

A list of standard genre codes and values found in the gnre atom. The codes are equivalent to the ID3v1 genre codes plus 1.

Traits

Ident

A trait providing information about an identifier.

Type Definitions

Result

Type alias for the result of tag operations.